#!/bin/bash

# Example usage script for ChatWithRepository

echo "🚀 ChatWithRepository Examples"
echo "=============================="

# Check if OpenAI API key is set
if [ -z "$OPENAI_API_KEY" ]; then
    echo "❌ Please set your OPENAI_API_KEY environment variable"
    echo "You can also run: python main.py setup"
    exit 1
fi

# Example 1: Add a popular repository
echo "📁 Adding requests library..."
python main.py add https://github.com/psf/requests --branch main

echo ""
echo "🔍 Querying requests library..."
python main.py query "How does the requests library handle HTTP timeout errors?" --repo https://github.com/psf/requests

echo ""
echo "🔍 Finding session management..."
python main.py query "Show me how sessions are implemented" --repo https://github.com/psf/requests

# Example 2: Add another repository
echo ""
echo "📁 Adding Flask..."
python main.py add https://github.com/pallets/flask --branch main

echo ""
echo "🔍 Explaining Flask routing..."
python main.py explain route --repo https://github.com/pallets/flask

echo ""
echo "🔍 Finding error handling..."
python main.py errors --repo https://github.com/pallets/flask

echo ""
echo "✅ Examples completed! Try interactive mode:"
echo "   python main.py interactive"